/**
 * Copyright (c) Enalean, 2018. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */

@import 'backlog-item-details';
@import 'backlog-item-transit';
@import './item-progress';

%hide-moves-icons {
    > .backlog-item-content-collapsed > .backlog-item-details-effort-container {
        left: 0;
    }

    > .backlog-item-details-moves {
        display: none;
    }
}

.backlog-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 0 $tlp-half-spacing;

    &.compact-view {
        .extra-card-fields {
            display: none;
        }
    }

    // We must use the child combinator because backlog-item can have children backlog-items
    &:first-child {
        > .backlog-item-details > .backlog-item-details-moves > .backlog-item-details-move:first-child {
            visibility: hidden;
        }
    }

    &:last-child {
        margin: 0;

        > .backlog-item-details:not(.moving-to) > .backlog-item-details-moves > .backlog-item-details-move:last-child {
            visibility: hidden;
        }
    }

    &:only-child:hover {
        > .backlog-item-details {
            @extend %hide-moves-icons;
        }
    }

    &.child {
        .backlog-item-details-effort-container,
        .backlog-item-details-parent {
            display: none;
        }
    }
}

.backlog-item-children-loading {
    @extend %loader;
}

.backlog-item-show-children {
    width: 95%;
}

.backlog-item-children {
    padding: $tlp-half-spacing;
    border-right: 1px solid $tlp-ui-border-normal;
    border-left: 1px solid $tlp-ui-border-normal;
    background: lighten($tlp-theme-background-color, 2%);
}

.backlog-item-show-children-handle {
    position: relative;
    height: 13px;
    border: 1px solid $tlp-ui-border-normal;
    border-top: 0;
    border-radius: 0 0 3px 3px;
    background: lighten($tlp-theme-background-color, 2%);
    cursor: pointer;

    &::before {
        content: '\f078';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: darken($tlp-ui-border-dark, 5%);
        font-family: FontAwesome;
        font-size: 8px;
    }

    &.closed::before {
        content: '\f077';
    }

    &:hover {
        background: lighten($tlp-theme-background-color, 3%);
    }
}
